package com.lh0811.forge.dependency.security.core.model.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * @author lh0811
 * @date 2021/5/7
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class SecurityRes implements Serializable {

    // 全部code资源权限
    public static String ALL = "ALL";

    @Schema(description = "资源名称", hidden = true)
    private String name;

    @Schema(description = "资源code", hidden = true)
    private String code;

    @Schema(description = "资源URL", hidden = true)
    private String url;

    /**
     * 全部url权限
     *
     * @return
     */
    public static SecurityRes allUrlRes() {
        SecurityRes allUrl = new SecurityRes();
        allUrl.setName("全url资源");
        allUrl.setCode("");
        allUrl.setUrl("/**");
        return allUrl;
    }

    /**
     * 全部code权限
     *
     * @return
     */
    public static SecurityRes allCodeRes() {
        SecurityRes allCode = new SecurityRes();
        allCode.setName("全Code权限");
        allCode.setCode(ALL);
        allCode.setUrl("");
        return allCode;
    }


}
